package com.dmwork.service.interaction.controller.front;

import com.dmwork.common.base.result.R;
import com.dmwork.service.interaction.entity.CmsBackground;
import com.dmwork.service.interaction.service.CmsBackgroundService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Transactional
@RestController
@RequestMapping("/front/dm_work/interaction/cms_background")
public class FrontCmsBackgroundController {

    @Autowired
    private CmsBackgroundService cmsBackgroundService;

    @ApiOperation("获取指定区域背景图片url")
    @GetMapping("get_background/{locationId}")
    public R getBackground(@PathVariable String locationId) {
        CmsBackground background = cmsBackgroundService.getById(locationId);
        return R.ok().data("url", background.getUrl());
    }

}
